﻿@{
    var smartData = (olierFrm.MVC.SmartPage.SmartPageData)ViewData["data"];
    Layout = null;
    var doUse = smartData.DataObject["UserDtl"];
}
<style>
    .meta
    {
        float: left;
        margin: 8px;
    }
</style>
<script>
    $(document).ready(function () {
        $("#formUser").SmartFormSubmit({ url: "/AjaxPost/UserModify", target: $("#save") }, function (msg) {
            var xx = 0;
            alert(msg.Message);
        });
    })
</script>
<form id="formUser">
<input type="hidden" name="[id][0]" value="@doUse.Tables[0].Rows[0]["nid"]" />
<input type="button" id="save" value="保存" />
<div>
    @{
        for (int i = 1; i < doUse.Tables[0].Columns.Count; i++)
        {
        <div class="meta">
            <div>@doUse.Tables[0].Columns[i].Caption</div>
            @{var name = "[" + @doUse.Tables[0].Columns[i].ColumnName + "][0]";}
            <div>
                <input type="text" name="@name" value="@doUse.Tables[0].Rows[0][i].ToString()"/>
            </div>
        </div>
        }
        <div style="clear: both;">
        </div>
    }
</div>
<table>
    <thead>
        <tr>
            <th>
                操作
            </th>
            @{
                for (int i = 0; i < doUse.Tables[1].Columns.Count; i++)
                {
                <th>@doUse.Tables[1].Columns[i].Caption
                </th>
                }
            }
        </tr>
    </thead>
    <tbody>
        @{
            for (int i = 0; i < doUse.Tables[1].Rows.Count; i++)
            {
            <tr>
                <td>
                    删除
                </td>
                <td>@doUse.Tables[1].Rows[i][0]
                <input type="hidden" value="@doUse.Tables[1].Rows[i][0]" name="[nID][1][@i]"/>
                </td>
                <td>@doUse.Tables[1].Rows[i][1]</td>
                @{for (int j = 2; j < doUse.Tables[1].Columns.Count; j++)
                  {
                    <td>
                        <input type="text" name="[@doUse.Tables[1].Columns[j].ColumnName][1][@i]" value="@doUse.Tables[1].Rows[i][j].ToString()"/>
                    </td>
                  }
                }
            </tr>
            }}
    </tbody>
</table>
</form>
